package com.oscarmovie.dao;

import java.util.List;

import org.hibernate.Query;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.oscarmovie.model.Datetime;

public class DatetimeDaoImpl extends HibernateDaoSupport implements DatetimeDao {

	public void save(Datetime datetime) {
		getSession().saveOrUpdate(datetime);
	}

	public Datetime load(int id) {
		Datetime datetime = (Datetime)getSession().load(Datetime.class, id);
		return datetime;
	}
	
	
	public List<Datetime> loadAll() {
		Query query = getSession().createQuery("from Datetime ");
		query.setCacheable(true);
		List<Datetime> list = (List<Datetime>)query.list();
		return list;
	}
	
}
